<?php echo validation_errors(); ?>
   
<div class="contentcontainer">
    <div class="headings altheading">
        <h2 class="left">Article Managerment</h2>
    </div>
    <div class="contentbox">
        <?php 
            $attributes = array('id' => 'frm_insert_ar','onsubmit'=>'return Form.1validateInsertRole(this)');
            print form_open($action,$attributes);
        ?>
            <p>
                <label for="textfield"><strong>title:</strong></label>
                <input type="text" name="title" value="<?php print (isset($article)) ? $article['title'] : set_value('title'); ?>" id="role_id" class="inputbox required" > <br />
                <span class="role_id_required smltxt red" style="display: none;">loi ko de trong</span>
            </p>
            <p>
                <label for="textfield"><strong>Tag:</strong></label>
                <input type="text" name="tag" value="<?php print (isset($article)) ? $article['tag'] : set_value('tag'); ?>" id="description" class="inputbox required" > <br />
                <span class="description_required smltxt red" style="display: none;">phai dien day du</span>
            </p>
            
            <p>
                <label for="textfield"><strong>Intro:</strong></label>
                <textarea name="intro" rows="3" cols="80"><?php print (isset($article)) ? $article['intro'] : set_value('intro'); ?></textarea>
                <br />
                <span class="description_required smltxt red" style="display: none;">phai dien day du</span>
            </p>
            <p>
                <label for="textfield"><strong>Image:</strong></label>
                <input type="text" name="image_path" value="<?php print (isset($article)) ? $article['image_path'] : set_value('image_path'); ?>" id="imagePath" class="inputbox required" >
            </p>
            <p><label for="textfield"><strong>Category:</strong></label>
                <select size="10" class="inputbox" id="parent" name="category_id">
                <?php foreach($categories As $key=>$category): ?>
                    <optgroup label="<?php print $category[0]['section']; ?>">
                        <?php foreach($category As $row):?>
                        <option <?php print (isset($article) && $row['value']['id'] == $article['category_id']) ? 'selected="selected"': '' ?> value="<?php print $row['value']['id'] ?>"><?php print $row['value']['name'] ?></option>
                        <?php endforeach; ?>
                    </optgroup>
                <?php endforeach; ?>   
                </select>
            </p>
            <p>
                <textarea id="editor1" name="content" rows="10" cols="80"><?php print (isset($article)) ? $article['content'] : set_value('content'); ?></textarea>
            </p>
            <p><input type="submit" value="Submit" class="btn" ></p>
        </form>
    </div>
</div>
 
<script type="text/javascript">
if ( typeof CKEDITOR == 'undefined' ){
    document.write(
        '<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
        'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
        'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
        'this file, changing the wrong paths in the &lt;head&gt; (line 5) and the "BasePath"' +
        'value (line 32).' ) ;
}else{
    var editor = CKEDITOR.replace( 'editor1' );
    CKFinder.setupCKEditor( editor, 'http://localhost/jimi/admin.php/ck/ckfinderpopup' ) ;
    // CKFinder.setupCKEditor( editor, { basePath : '../', skin : 'v1' } ) ;
}
</script>
